package tests
{
	import com.salesforce.AsyncResponder;
	import com.salesforce.objects.LoginRequest;
	import com.salesforce.results.LoginResult;
	
	import flexunit.framework.TestCase;
	
	import mx.core.Application;
	
	public class LoginTest extends TestCase
	{
	    public function testLogin():void
	    {   
	    	var lr:LoginRequest = new LoginRequest();
	    	lr.session_id = Application.application.parameters.session_id;
	    	lr.server_url = Application.application.parameters.server_url;
	    	lr.username = "dev@mavericks.demo";
	    	lr.password = "123456";	
	    	lr.callback = new AsyncTestResponder(loginResultHandler, this, 4000);
			
			TestModel.getGlobal().apex.login(lr);
	    }
	    
	    private function loginResultHandler(result:LoginResult):void
	    {
	    	assertNotNull(result);
	    	assertNotNull(result.userId);
	    	assertNotNull(result.sessionId);
	    }
	}
}